<?php
/**
 * FileName: BaseWebController.php
 * Author: Fei.Song
 * Date: 2021/4/1 11:34
 * Created by PhpStorm
 * Desc: 前台基类
 */

namespace App\Http\Controllers;

use App\Service\LogService;
use Illuminate\Http\Request;

class BaseWebController extends Controller {
    use TraitController,TraitValidation;

    public function __construct(Request $request) {
        $this->middleware(function ($request, $next) {
            $this->guard_name = "web";
            $this->request = $request;
            $this->_init();

            return $next($request);
        });
    }

    //开启日志
    public function log($level, $module, $action, $message, $data = null) {
        (new LogService())->log($level, $module, $action, $message, $data);
    }

}
